<?php
namespace app\index;
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/9 0009
 * Time: 下午 4:28
 */

use think\Controller;
use think\Config;
use com\gdl\agk\interfaces\UserServiceClient;
use com\gdl\agk\dataobject\user\UserRequestDTO;

class Base extends Controller
{
    protected $time = null;


    public function __construct()
    {
         parent::__construct();
         $this->time = time();
    }
    
    /**
     * 查询用户信息
     * @param int $identity_id
     * @return boolean
     */
    protected function getUserInfoById($identity_id)
    {
        try {
            //查询当前用户
            \ApiClient::init(Config::get('api.appid'), Config::get('api.secret'), 30, array('gdlApiSdk'));

            $userService = new UserServiceClient(NULL);
            \ApiClient::build($userService);
            $userDo = new UserRequestDTO();
            $userDo->id = $identity_id;
            $userDo->field = 'ex_user_company.id,ex_user_company.admin_reg,ex_user.userid';
            $user = $userService->getUserInfoById($userDo);
            $userData = $user->data;
            return $userData;
        } catch (Exception $ex) {
            \SLogger::getLogger('pub_thrift_service', 'thrift_error')->error('thrift call error', $ex);
            return FALSE;
        }
    }
}
